﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ListenMusic.Models.Public;
using ListenMusic.Models.ViewModel;
using System.ServiceModel;
namespace ListenMusic.Controllers.Public
{
    public class SearchController : HomeController
    {
        //
        // GET: /Search/
        private SongRepository sp;
        private AlbumRepository ap;
        public SearchController()
        {
            sp = new SongRepository();
            ap = new AlbumRepository();
        }
       
        public ActionResult Result(string key)
        {
            try
            {
                
                SearchViewModel viewModel = new SearchViewModel
                {
                    song = sp.getSongBySinger(key),
                    album = ap.getAlbumBySinger(key),

                };
                return View(viewModel);
            }
            catch (FaultException ex)
            {
                throw ex;
            }
        }

    }
}
